package com.collection.dto;

import java.io.Serializable;

import org.apache.commons.lang3.builder.ToStringBuilder;

public class ResponseDTO implements Serializable {
	private static final long serialVersionUID = 1L;
	private String timestamp;
	private Object results;
	private int status = 200;
	private String msg;

	/**
	 * 构建成功响应对象
	 * @param results
	 * @param msg
	 */
	public ResponseDTO(Object results, String msg) {
		super();
		this.timestamp=String.valueOf(System.currentTimeMillis());
		this.status = 200;
		this.msg = msg;
		this.results = results;
	}
	/***
	 * 构建失败响应对象
	 * @param results
	 * @param errorCode
	 * @param msg
	 */
	public ResponseDTO(Object results, int errorCode, String msg) {
		this.timestamp=String.valueOf(System.currentTimeMillis());
		this.status = errorCode;
		this.msg = msg;
		this.results = results;
	}

	public String getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(String timestamp) {
		this.timestamp = timestamp;
	}

	public Object getResults() {
		return results;
	}

	public void setResults(Object results) {
		this.results = results;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}
	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}
}
